package cn.cheln.explorer.ds.scan;

import android.content.Context;
import android.content.Intent;
import android.os.HandlerThread;
import android.widget.Toast;
import cn.cheln.explorer.config.Config;
import cn.cheln.explorer.config.Constants;
import cn.cheln.explorer.ds.sdcard.TypeFilter;
import cn.cheln.explorer.ds.sdcard.TypeFilter.TextWrapper;
import cn.cheln.explorer.ds.uri.NavigationConstants;
import cn.cheln.explorer.ds.uri.NavigationNode;
import cn.cheln.explorer.ds.uri.NavigationPool;
import cn.cheln.support.log.Logs;
import cn.cheln.support.unknown.ComparatorRepo;
import com.direction.hold.ui.CountActivity;
import java.io.File;
import java.io.FileFilter;
import java.util.Map;
import java.util.Stack;
import java.util.TreeMap;

public class Scanner extends TypeFilter
  implements FileFilter
{
  static boolean isRunning;
  static String runningScanCategory = "";
  static Thread scanThread;
  String catename;
  Context context;
  private MirrManager dataSychroInMemory;
  String ext;
  int i = 0;
  Map<String, String> oftenUsedType = new TreeMap(ComparatorRepo.stringKey);
  String type;

  public Scanner(MirrManager paramMirrManager, Context paramContext, Integer[] paramArrayOfInteger, TypeFilter.TextWrapper[] paramArrayOfTextWrapper, String[] paramArrayOfString, String paramString)
  {
    super(paramArrayOfInteger, paramArrayOfTextWrapper, paramArrayOfString);
    this.context = paramContext;
    this.type = paramString;
    this.dataSychroInMemory = paramMirrManager;
    paramMirrManager.receiveDBImage(paramContext, paramString);
    if ((paramString == null) || (paramString.equals("image")))
    {
      this.oftenUsedType.put("jpg", "image");
      this.oftenUsedType.put("jpeg", "image");
      this.oftenUsedType.put("bmp", "image");
      this.oftenUsedType.put("gif", "image");
      this.oftenUsedType.put("png", "image");
      this.oftenUsedType.put("webp", "image");
    }
    if ((paramString == null) || (paramString.equals("audio")))
    {
      this.oftenUsedType.put("mp3", "audio");
      this.oftenUsedType.put("wav", "audio");
      this.oftenUsedType.put("amr", "audio");
    }
    if ((paramString == null) || (paramString.equals("video")))
    {
      this.oftenUsedType.put("avi", "video");
      this.oftenUsedType.put("wmv", "video");
      this.oftenUsedType.put("mpg", "video");
      this.oftenUsedType.put("3gp", "video");
      this.oftenUsedType.put("mp4", "video");
      this.oftenUsedType.put("mkv", "video");
      this.oftenUsedType.put("webm", "video");
      this.oftenUsedType.put("m4v", "video");
      this.oftenUsedType.put("mov", "video");
    }
    if ((paramString == null) || (paramString.equals("doc")))
    {
      this.oftenUsedType.put("doc", "doc");
      this.oftenUsedType.put("docx", "doc");
      this.oftenUsedType.put("xls", "doc");
      this.oftenUsedType.put("xlsx", "doc");
      this.oftenUsedType.put("ppt", "doc");
      this.oftenUsedType.put("pptx", "doc");
      this.oftenUsedType.put("htm", "doc");
      this.oftenUsedType.put("html", "doc");
      this.oftenUsedType.put("txt", "doc");
      this.oftenUsedType.put("rtx", "doc");
      this.oftenUsedType.put("rtf", "doc");
      this.oftenUsedType.put("zip", "doc");
      this.oftenUsedType.put("csv", "doc");
      this.oftenUsedType.put("rar", "doc");
      this.oftenUsedType.put("pdf", "doc");
    }
    if ((paramString == null) || (paramString.equals("apk")))
      this.oftenUsedType.put("apk", "apk");
    if ((paramString != null) && (!(paramString.equals("lewa/theme"))))
      return;
    this.oftenUsedType.put("lwt", "lewa/theme");
  }

  public static void scan(String paramString, Context paramContext)
  {
    if (isRunning)
    {
      Object[] arrayOfObject2 = new Object[1];
      arrayOfObject2[0] = runningScanCategory;
      Toast.makeText(paramContext, paramContext.getString(2131034231, arrayOfObject2), 0).show();
      return;
    }
    while (true)
    {
      try
      {
        runningScanCategory = ((NavigationNode)CountActivity.categoryActivity.navTool.navEntity.peek()).displayname;
        if (runningScanCategory == null)
        {
          str1 = "";
          runningScanCategory = str1;
          String str2 = paramContext.getString(2131034132);
          CountActivity.categoryActivity.setScanBarHide(false);
          CountActivity.categoryActivity.hideScanBar(0);
          if ((!(runningScanCategory.equals(str2))) && (!(runningScanCategory.equals(""))))
          {
            Object[] arrayOfObject1 = new Object[1];
            arrayOfObject1[0] = runningScanCategory;
            Toast.makeText(paramContext, paramContext.getString(2131034230, arrayOfObject1), 0).show();
          }
          Logs.i("-------------->>" + runningScanCategory);
          if (!(runningScanCategory.equals(str2)))
            break label245;
          str3 = paramContext.getString(2131034232);
          String str4 = str3;
          Logs.i("-------------->> finalFinishText" + str4);
          scanThread = new HandlerThread("", 19, paramString, paramContext, str4)
          {
            public void run()
            {
              Scanner.scanCategory(this.val$scanCategory, this.val$context, this.val$finalFinishText);
              Scanner.isRunning = false;
            }
          };
          scanThread.start();
          isRunning = true;
          return;
        }
        String str1 = runningScanCategory;
      }
      catch (Exception localException)
      {
        return;
      }
      if (runningScanCategory.equals(""))
        label245: str3 = "";
      String str3 = paramContext.getString(2131034229) + runningScanCategory;
      Logs.i("-------------->> finishText" + str3);
    }
  }

  public static void scanCategory(String paramString1, Context paramContext, String paramString2)
  {
    MirrManager localMirrManager = new MirrManager();
    Integer[] arrayOfInteger = new Integer[2];
    arrayOfInteger[0] = Integer.valueOf(4);
    arrayOfInteger[1] = Integer.valueOf(Config.getHiddenOption(Config.ACCOUNT_HIDE_OPTION));
    Scanner localScanner = new Scanner(localMirrManager, paramContext, arrayOfInteger, Constants.HIDDEN_EXCLUDED, null, paramString1);
    new File(NavigationConstants.SDCARD_PATH).listFiles(localScanner);
    localMirrManager.clearNoUseData(paramContext);
    Intent localIntent = new Intent("com.lewa.app.filemanager.receiveScanSignal");
    Logs.i("", "-------------->>>" + paramString1);
    if ((paramString1 != null) && (!(paramString1.trim().equals(""))))
      localIntent.putExtra("scanFinishedToast", paramString2);
    localIntent.putExtra("scanFinished", true);
    paramContext.sendBroadcast(localIntent);
  }

  // ERROR //
  public boolean accept(File paramFile)
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_1
    //   2: invokespecial 331	cn/cheln/explorer/ds/sdcard/TypeFilter:accept	(Ljava/io/File;)Z
    //   5: ifne +5 -> 10
    //   8: iconst_0
    //   9: ireturn
    //   10: aload_0
    //   11: ldc 28
    //   13: putfield 333	cn/cheln/explorer/ds/scan/Scanner:catename	Ljava/lang/String;
    //   16: aload_0
    //   17: ldc 28
    //   19: putfield 335	cn/cheln/explorer/ds/scan/Scanner:ext	Ljava/lang/String;
    //   22: aload_1
    //   23: invokevirtual 339	java/io/File:isDirectory	()Z
    //   26: ifeq +102 -> 128
    //   29: aload_0
    //   30: ldc_w 341
    //   33: putfield 333	cn/cheln/explorer/ds/scan/Scanner:catename	Ljava/lang/String;
    //   36: iconst_0
    //   37: istore_2
    //   38: aconst_null
    //   39: astore_3
    //   40: aload_0
    //   41: getfield 56	cn/cheln/explorer/ds/scan/Scanner:dataSychroInMemory	Lcn/cheln/explorer/ds/scan/MirrManager;
    //   44: invokevirtual 345	cn/cheln/explorer/ds/scan/MirrManager:getMemoryImage	()Ljava/util/Map;
    //   47: aload_0
    //   48: getfield 333	cn/cheln/explorer/ds/scan/Scanner:catename	Ljava/lang/String;
    //   51: invokeinterface 349 2 0
    //   56: checkcast 351	cn/cheln/explorer/ds/scan/MirrDetail
    //   59: astore_3
    //   60: new 353	cn/cheln/explorer/beans/UpdateBean
    //   63: dup
    //   64: aconst_null
    //   65: aload_1
    //   66: invokevirtual 356	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   69: aload_1
    //   70: invokevirtual 360	java/io/File:length	()J
    //   73: invokestatic 363	java/lang/String:valueOf	(J)Ljava/lang/String;
    //   76: aload_1
    //   77: invokevirtual 366	java/io/File:lastModified	()J
    //   80: invokestatic 363	java/lang/String:valueOf	(J)Ljava/lang/String;
    //   83: aconst_null
    //   84: aconst_null
    //   85: invokespecial 369	cn/cheln/explorer/beans/UpdateBean:<init>	(Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Boolean;)V
    //   88: astore 8
    //   90: aload_3
    //   91: getfield 372	cn/cheln/explorer/ds/scan/MirrDetail:records	Ljava/util/Map;
    //   94: aload_1
    //   95: invokevirtual 356	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   98: invokeinterface 349 2 0
    //   103: checkcast 353	cn/cheln/explorer/beans/UpdateBean
    //   106: astore 9
    //   108: aload 8
    //   110: aload 9
    //   112: invokevirtual 373	cn/cheln/explorer/beans/UpdateBean:equals	(Ljava/lang/Object;)Z
    //   115: istore_2
    //   116: invokestatic 378	cn/cheln/support/mobile/sdcard/SDcardChecker:srcardStateResolve	()Z
    //   119: istore 10
    //   121: iload 10
    //   123: ifeq +114 -> 237
    //   126: iconst_0
    //   127: ireturn
    //   128: aload_0
    //   129: aload_1
    //   130: invokevirtual 381	java/io/File:getName	()Ljava/lang/String;
    //   133: invokestatic 387	cn/cheln/explorer/beans/FileUtil:getRealLowerCaseExtension	(Ljava/lang/String;)Ljava/lang/String;
    //   136: putfield 335	cn/cheln/explorer/ds/scan/Scanner:ext	Ljava/lang/String;
    //   139: aload_0
    //   140: getfield 335	cn/cheln/explorer/ds/scan/Scanner:ext	Ljava/lang/String;
    //   143: invokevirtual 390	java/lang/String:length	()I
    //   146: ifne +5 -> 151
    //   149: iconst_0
    //   150: ireturn
    //   151: aload_0
    //   152: aload_0
    //   153: getfield 48	cn/cheln/explorer/ds/scan/Scanner:oftenUsedType	Ljava/util/Map;
    //   156: aload_0
    //   157: getfield 335	cn/cheln/explorer/ds/scan/Scanner:ext	Ljava/lang/String;
    //   160: invokeinterface 349 2 0
    //   165: checkcast 66	java/lang/String
    //   168: putfield 333	cn/cheln/explorer/ds/scan/Scanner:catename	Ljava/lang/String;
    //   171: aload_0
    //   172: getfield 333	cn/cheln/explorer/ds/scan/Scanner:catename	Ljava/lang/String;
    //   175: ifnonnull +17 -> 192
    //   178: aload_0
    //   179: aload_0
    //   180: getfield 335	cn/cheln/explorer/ds/scan/Scanner:ext	Ljava/lang/String;
    //   183: invokestatic 395	cn/cheln/support/images/MimeUtil:parseWholeMime	(Ljava/lang/String;)Ljava/lang/String;
    //   186: invokestatic 400	cn/cheln/explorer/ds/util/FileMgrCategory:getCategory	(Ljava/lang/String;)Ljava/lang/String;
    //   189: putfield 333	cn/cheln/explorer/ds/scan/Scanner:catename	Ljava/lang/String;
    //   192: aload_0
    //   193: getfield 333	cn/cheln/explorer/ds/scan/Scanner:catename	Ljava/lang/String;
    //   196: ifnull +39 -> 235
    //   199: aload_0
    //   200: getfield 333	cn/cheln/explorer/ds/scan/Scanner:catename	Ljava/lang/String;
    //   203: invokevirtual 312	java/lang/String:trim	()Ljava/lang/String;
    //   206: ldc 28
    //   208: invokevirtual 70	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   211: ifne +24 -> 235
    //   214: aload_0
    //   215: getfield 54	cn/cheln/explorer/ds/scan/Scanner:type	Ljava/lang/String;
    //   218: ifnull -182 -> 36
    //   221: aload_0
    //   222: getfield 333	cn/cheln/explorer/ds/scan/Scanner:catename	Ljava/lang/String;
    //   225: aload_0
    //   226: getfield 54	cn/cheln/explorer/ds/scan/Scanner:type	Ljava/lang/String;
    //   229: invokevirtual 70	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   232: ifne -196 -> 36
    //   235: iconst_0
    //   236: ireturn
    //   237: iload_2
    //   238: ifne +57 -> 295
    //   241: aload 9
    //   243: ifnull +132 -> 375
    //   246: ldc_w 402
    //   249: astore 11
    //   251: ldc 28
    //   253: aload 11
    //   255: invokestatic 309	cn/cheln/support/log/Logs:i	(Ljava/lang/String;Ljava/lang/String;)V
    //   258: aload_3
    //   259: getfield 406	cn/cheln/explorer/ds/scan/MirrDetail:operUri	Landroid/net/Uri;
    //   262: astore 12
    //   264: aload_0
    //   265: getfield 52	cn/cheln/explorer/ds/scan/Scanner:context	Landroid/content/Context;
    //   268: astore 13
    //   270: aload 9
    //   272: ifnull +111 -> 383
    //   275: iconst_1
    //   276: istore 14
    //   278: aload_1
    //   279: aload 12
    //   281: aload 13
    //   283: iload 14
    //   285: aload 9
    //   287: aload_0
    //   288: getfield 335	cn/cheln/explorer/ds/scan/Scanner:ext	Ljava/lang/String;
    //   291: invokestatic 410	cn/cheln/explorer/ds/scan/MirrManager:doDBSync	(Ljava/io/File;Landroid/net/Uri;Landroid/content/Context;ZLcn/cheln/explorer/beans/UpdateBean;Ljava/lang/String;)Z
    //   294: pop
    //   295: iload_2
    //   296: ifne +50 -> 346
    //   299: aload_0
    //   300: iconst_1
    //   301: aload_0
    //   302: getfield 50	cn/cheln/explorer/ds/scan/Scanner:i	I
    //   305: iadd
    //   306: putfield 50	cn/cheln/explorer/ds/scan/Scanner:i	I
    //   309: aload_0
    //   310: getfield 50	cn/cheln/explorer/ds/scan/Scanner:i	I
    //   313: sipush 500
    //   316: irem
    //   317: ifne +29 -> 346
    //   320: new 301	android/content/Intent
    //   323: dup
    //   324: ldc_w 303
    //   327: invokespecial 304	android/content/Intent:<init>	(Ljava/lang/String;)V
    //   330: astore 7
    //   332: aload_0
    //   333: getfield 52	cn/cheln/explorer/ds/scan/Scanner:context	Landroid/content/Context;
    //   336: aload 7
    //   338: invokevirtual 327	android/content/Context:sendBroadcast	(Landroid/content/Intent;)V
    //   341: aload_0
    //   342: iconst_0
    //   343: putfield 50	cn/cheln/explorer/ds/scan/Scanner:i	I
    //   346: aload_3
    //   347: getfield 372	cn/cheln/explorer/ds/scan/MirrDetail:records	Ljava/util/Map;
    //   350: aload_1
    //   351: invokevirtual 356	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   354: invokeinterface 413 2 0
    //   359: pop
    //   360: aload_1
    //   361: invokevirtual 339	java/io/File:isDirectory	()Z
    //   364: ifeq +35 -> 399
    //   367: aload_1
    //   368: aload_0
    //   369: invokevirtual 295	java/io/File:listFiles	(Ljava/io/FileFilter;)[Ljava/io/File;
    //   372: pop
    //   373: iconst_0
    //   374: ireturn
    //   375: ldc_w 415
    //   378: astore 11
    //   380: goto -129 -> 251
    //   383: iconst_0
    //   384: istore 14
    //   386: goto -108 -> 278
    //   389: astore 4
    //   391: aload 4
    //   393: invokevirtual 418	java/lang/Exception:printStackTrace	()V
    //   396: goto -101 -> 295
    //   399: iconst_0
    //   400: ireturn
    //   401: astore 4
    //   403: iconst_0
    //   404: istore_2
    //   405: goto -14 -> 391
    //   408: astore 4
    //   410: goto -19 -> 391
    //
    // Exception table:
    //   from	to	target	type
    //   40	90	389	java/lang/Exception
    //   90	108	401	java/lang/Exception
    //   108	121	408	java/lang/Exception
    //   251	270	408	java/lang/Exception
    //   278	295	408	java/lang/Exception
  }
}

/* Location:           H:\360云盘\lewa_explorer_3.0\bin\FileApp_orig_dex2jar.jar
 * Qualified Name:     cn.cheln.explorer.ds.scan.Scanner
 * JD-Core Version:    0.5.2
 */